import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { BaseHttpService } from '../../../../../shared/services/baseHttp.service';

/**
 * Company header service
 * 
 * Author: Sorin Spiru
 * Date: 13.01.2018
 */
@Injectable()
export class CompanyHeaderService extends BaseHttpService {

    constructor(public http: HttpClient) {
        super();
    }

    /**
     * Add company to portfolio
     * @param portfolioId Portfolio unique identifier
     * @param companyId Company unique identifier
     */
    public addCompanyToPortfolio(portfolioId: string, companyId: string): Observable<any> {
        return this.http.post(this.serverUrl + 'portfolioserv/api/v1/portfolios/' + portfolioId + '/details/' + companyId, null, { responseType: 'text' });
    }

    /**
     * Add company to collection of most active reports
     * @param companyId Company unique identifier
     */
    public addCompanyToMostActiveReports(companyId: string): Observable<any> {
        return this.http.post(this.serverUrl + 'marserv/api/v1/MostActiveReport/' + companyId, null, { responseType: "text" });
    }
}